﻿
namespace RecruitmentAgency.Models.DataTypes
{
    /// <summary>
    /// The RecruitmentAgency.Models.Cv.DataTypes.PersonReferee contains details about a referee for the user whose ID number is specified with the PersonId property
    /// </summary>
    public class PersonReferee
    {
        /// <summary>
        /// Gets or sets the ID number of the referee record
        /// </summary>
        public int RefereeId { get; set; }

        /// <summary>
        /// Gets or sets the ID number of the user that the referee record relates to
        /// </summary>
        public int PersonId { get; set; }

        /// <summary>
        /// Gets or sets the title of the referee
        /// </summary>
        public string RefereeTitle { get; set; }

        /// <summary>
        /// Gets or sets the first name of the referee
        /// </summary>
        public string RefereeFirstName { get; set; }

        /// <summary>
        /// Gets or sets the last name of the referee
        /// </summary>
        public string RefereeLastName { get; set; }

        /// <summary>
        /// Gets or sets the first line of the address of the referee
        /// </summary>
        public string RefereeAddressLine1 { get; set; }

        /// <summary>
        /// Gets or sets the second line of the address of the referee
        /// </summary>
        public string RefereeAddressLine2 { get; set; }

        /// <summary>
        /// Gets or sets the town of the referee
        /// </summary>
        public string RefereeTown { get; set; }

        /// <summary>
        /// Gets or sets the post code of the referee
        /// </summary>
        public string RefereePostCode { get; set; }

        /// <summary>
        /// Gets or sets the phone number of the referee
        /// </summary>
        public string RefereePhone { get; set; }

        /// <summary>
        /// Gets or sets the e-mail address of the referee
        /// </summary>
        public string Email { get; set; }

        /// <summary>
        /// Gets or sets the relationship between the user and the referee
        /// </summary>
        public string Relationship { get; set; }

        /// <summary>
        /// Gets or sets the occupation of the referee
        /// </summary>
        public string Occupation { get; set; }

        /// <summary>
        /// Gets or sets the number of years that the user has known the referee
        /// </summary>
        public string YearsKnown { get; set; }

        /// <summary>
        /// Gets or sets a written reference from the referee
        /// </summary>
        public string ReferenceText { get; set; }

        /// <summary>
        /// Gets or sets a Boolean value that determines whether permission has been granted to contact the referee
        /// </summary>
        public bool PermissionToContact { get; set; }

        /// <summary>
        /// Gets or sets a Boolean value that determines whether permission has been granted to store the referee details
        /// </summary>
        public bool PermissionToStoreDetails { get; set; }

        /// <summary>
        /// Gets or sets a Boolean value that determines whether the referee record has been verified
        /// </summary>
        public bool RefereeVerified { get; set; }

        /// <summary>
        /// Gets or sets the type of verification received for the referee record
        /// </summary>
        public string RefereeVerificationType { get; set; }

        /// <summary>
        /// Gets a Boolean value that determines whether the RecruitmentAgency.Models.Cv.DataTypes.PersonReferee is to be considered to be null
        /// </summary>
        public bool IsNull
        {
            get
            {
                return RefereeTitle == null && RefereeFirstName == null && RefereeLastName == null && RefereeAddressLine1 == null && RefereeAddressLine2 == null && RefereeTown == null && RefereePostCode == null && Relationship == null && Occupation == null && (YearsKnown == null || YearsKnown == "0");
            }
        }

        /// <summary>
        /// Returns a short summary of the referee record
        /// </summary>
        /// <returns>A short summary of the referee record</returns>
        public string ToShortString()
        {
            return string.Format("{0} {1}, {2}. Known as {3} for {4} {5}.", RefereeFirstName, RefereeLastName, Occupation, Relationship.ToLower(), YearsKnown, (YearsKnown == "1" ? "year" : "years"));
        }
    }
}